package com.zhiwei.version.controller;

import com.zhiwei.common.constant.ResultResponseMsg;
import com.zhiwei.common.dto.PageDataDto;
import com.zhiwei.common.util.BeanConverterUtil;
import com.zhiwei.version.controller.vo.ConfigQueryVo;
import com.zhiwei.version.dto.ConfigDto;
import com.zhiwei.version.dto.ConfigQueryDto;
import com.zhiwei.version.service.ConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * function 项目配置控制器
 * author zhiwei.yang
 * time 2020-3-14-14:54
 */
@RestController
@RequestMapping("/config")
@Api(description = "项目配置控制器")
public class ProjectConfigController {

    @Autowired
    private ConfigService configService;

    @ApiOperation(value = "/queryByPage", notes = "项目配置分页查询")
    @GetMapping("/queryByPage")
    public ResultResponseMsg queryByPage(@RequestBody ConfigQueryVo configQueryVo){
        ConfigQueryDto configQueryDto = BeanConverterUtil.convertToBean(configQueryVo, ConfigQueryDto.class);
        PageDataDto<ConfigDto> pageDataDto = configService.queryByPage(configQueryDto);
        return ResultResponseMsg.buildSuccessResultMsg(pageDataDto);
    }
}
